'''
Created on Sep 4, 2013

@author: marchi
'''
import numpy as np

def corr(filename):
    fp=open(filename);
    G=fp.readlines()
    G1=G[0].split()
    H0=np.reshape(G1,[len(G1)/3,3])
    H=np.array(H0,dtype=float)
    X=H[:,0]
    Y=H[:,1]
    
    Z=H[:,2]
    Tot=X*X+Y*Y+Z*Z
    print X.mean()
    convX=np.convolve(X, X)
    convY=np.convolve(Y, Y)
    convZ=np.convolve(Z, Z)
    convTot=convX+convY+convZ;
    upp=convTot[0];convTot=convTot/upp;
    for o in range(len(convTot)):
        print o,convTot[o];
    print convTot.shape
    print convTot[0], convTot[20]
    print Tot.mean()
    
    